home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 138
/
Volume 138 Aug 19 2011 - Damaged.iso
/
Games
/
tobby_on_ice.swf
/
scripts
/
DefineSprite_158
/
frame_1
/
DoAction.as
Wrap
Text File
|
2011-08-19
|
1KB
|
55 lines
function main()
{
if(_root.pauseFlg)
{
return undefined;
}
switch(this.stat)
{
case "walk":
this.walk();
break;
case "stay":
}
}
function walk()
{
var _loc1_ = this;
_loc1_._x += _loc1_.pdx;
if(_loc1_._x > 130)
{
_loc1_._x = 130;
_loc1_.pdx = -4;
_loc1_._xscale = -100;
}
if(_loc1_._x < 20)
{
_loc1_._x = 20;
_loc1_.pdx = 4;
_loc1_._xscale = 100;
}
if(_loc1_.stat != "stay")
{
if(_loc1_.hitMC.hitTest(_root.tobbyMC.hitMC))
{
var _loc2_ = _root.tobbyMC.hitJr(_loc1_.pdx);
if(_loc2_)
{
_loc1_.stat = "stay";
_loc1_.anmMC.gotoAndPlay("win");
}
}
}
}
function reset()
{
var _loc1_ = this;
_loc1_._xscale = 100;
_loc1_.pdx = 4;
_loc1_.stat = "walk";
_loc1_.anmMC.gotoAndPlay("walk");
}
this.pdx = 4;
this.stat = "walk";
this._x = 20 + _root.randomInt(100);